package com.yy.micro.magic.data.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yy.micro.magic.data.model.base.JpaObjectWithDynamicFields;
import com.yy.micro.magic.data.model.converter.TypedListConverter;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Proxy;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Proxy(lazy = false)
@Entity
@Table(name = "T_M_DYNAMIC_TRIGGER")
public class DynamicTriggerEntity extends JpaObjectWithDynamicFields {
    @Id
    @Column(name="[ID]")
    @GeneratedValue(strategy = GenerationType.AUTO,generator = "snowflake")
    @GenericGenerator(name = "snowflake",strategy = SnowflakeIdWorker.NAME)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @Column(name = "PLAN_CODE",nullable = false)
    private String planCode;

    private boolean disable = Boolean.FALSE;

    @Column(nullable = false,name = "[TRIGGER]")
    private String trigger;

    @Convert(converter = TypedListConverter.class)
    @Column(nullable = false)
    private List<String> patterns;


    public Long getId() {
        return id;
    }

    public void setId(final Long id) {
        this.id = id;
    }

    public String getPlanCode() {
        return planCode;
    }

    public void setPlanCode(final String planCode) {
        this.planCode = planCode;
    }

    public boolean isDisable() {
        return disable;
    }

    public void setDisable(final boolean disable) {
        this.disable = disable;
    }

    public String getTrigger() {
        return trigger;
    }

    public void setTrigger(final String trigger) {
        this.trigger = trigger;
    }

    public List<String> getPatterns() {
        return patterns;
    }

    public void setPatterns(final List<String> patterns) {
        this.patterns = patterns;
    }

    @Override
    public String getIdProperty() {
        return "id";
    }
}
